﻿@{
    Bundle("markItUpBBCode");
    Bundle("jquery_validate");
}
           
<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('@ID("#form")').validate({
            rules: {
                text: {
                    required: true
                }
            }
        });
        jQuery('@ID("#txt_text")').markItUp(markItUpBBCodeSet);
    });
</script>
<form class="common-form" id="@ID("form")" action="@Url.Action(Loc.Act(Model.UserCanModerate ? "Moderate" : "Update").Localized())" method="post">
    @if(Model.UserCanModerate)
    {
        <input type="hidden" name="flags" value="None" />
    }
    <input type="hidden" name="id" value="@JDM.Int32(Model.Post.EntityID)" />
    <table>
        <tr>
            <td>
                <label>@T(Res.Name("Text"))</label>
            </td>
            <td>
                <textarea id="@ID("txt_text")" name="text" maxlength="4000">@JDM.String(Model.Post.Text))</textarea>
            </td>
        </tr>
        @if(Model.UserCanModerate)
        {
            <tr>
                <td>
                    <label>@T(Res.In("API").Of("Enum").Of("ForumPostFlags").Name("Active"))</label>
                </td>
                <td>
                    <input type="checkbox" name="flags" value="Active" @(JDM.HasFlags(Model.Post.Flags, "Active") ? "checked" : String.Empty) />
                </td>
            </tr>
        }
    </table>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>
